<div class="page-body">
    <div class="row">
        <div class="widget">
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal" role="form"
                          action="{:U('addBook')}"
                          method="post" enctype="multipart/form-data">
                        <input type="hidden" name="bag_id" value="{$bag.bag_id}" />
                        <div class="form-group">
                            <label for="bag_card" class="col-sm-3 control-label no-padding-right">书包编号：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" id="bag_card" name="bag_card" value="{$bag.bag_card}" readonly required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-3 control-label no-padding-right">书包名称：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" id="name" name="bag_name" readonly value="{$bag.bag_name}" placeholder="请输入书包名称..." required>
                            </div>
                        </div>

                        <div class="form-group bottom-div">
                            <div class="col-sm-offset-3 col-sm-10">
                                <button type="submit" class="btn btn-primary">提 交</button>
                                <button type="button" id="add-book" class="btn btn-success">创建图书栏</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('#add-book').click(function(){
        var str =' <div class="form-group">\n' +
            '                            <label for="name" class="col-sm-3 control-label no-padding-right">图书条码：</label>\n' +
            '                            <div class="col-sm-3">\n' +
            '                                <input type="text" class="form-control"  name="code[]" placeholder="请输入图书条码..." required>\n' +
            '                            </div>\n' +
            '                        </div>';

        $('.bottom-div').before(str);
    });
</script>